package com.example.demo01.Service.webService;

import com.example.demo01.Dao.webDao.WarnRecordEntityDao;
import com.example.demo01.Entity.webEntity.NameValue;
import com.example.demo01.Entity.webEntity.WarnDetail;
import com.example.demo01.Entity.webEntity.WarnRecordEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class WarnRecordEntityService {
    @Autowired
    WarnRecordEntityDao warnRecordEntityDao;

    /**
     * 获取报警省份信息
     * */
    public List<NameValue> getProvinceOfWarn() { return warnRecordEntityDao.getProvinceOfWarn(); }

    /**
     * 根据省份编码获取报警市级信息
     * @param provinceCode 省份编码
     * */
    public List<NameValue> getCityOfWarn(String provinceCode) { return warnRecordEntityDao.getCityOfWarn(provinceCode); }

    /**
     * 根据市级编码获取报警县区信息
     * */
    public List<NameValue> getCountryOfWarn(String cityCode) { return warnRecordEntityDao.getCountryOfWarn(cityCode); }

    /**
     * 获取所有报警信息
     * */
    public List<WarnRecordEntity> getAllWarnRecords() { return warnRecordEntityDao.getAllWarnRecords(); }

    /**
     * 获取待处理的报警信息
     * */
    public List<WarnRecordEntity> getUnResolvedWarnRecords() { return warnRecordEntityDao.getUnResolvedWarnRecords(); }

    /**
     * 根据省级编码获取报警信息
     * */
    public List<WarnRecordEntity> getWarnRecordByProvinceCode(String provinceCode) { return warnRecordEntityDao.getWarnRecordByProvinceCode(provinceCode);}

    /**
     * 根据市级编码获取报警信息
     * */
    public List<WarnRecordEntity> getWarnRecordByCityCode(String cityCode){ return warnRecordEntityDao.getWarnRecordByCityCode(cityCode);}

    /**
     * 根据县区级编码获取报警信息
     * */
    public List<WarnRecordEntity> getWarnRecordByCountryCode(String countryCode){ return warnRecordEntityDao.getWarnRecordByCountryCode(countryCode); }

    /**
     * 根据时间限定获取报警信息
     * */
    public List<WarnRecordEntity> getWarnRecordByTimeLimted(String startTime,String endTime) { return warnRecordEntityDao.getWarnRecordByTimeLimted(startTime,endTime); }

    /**
     * 根据地理范围获取报警信息点结合
     * @param bounds 行政区划范围顶点数组
     * */
    public List<WarnRecordEntity> getWarnRecordByBounds(String bounds) { return warnRecordEntityDao.getWarnRecordByBounds(bounds); }

    /**
     * 根据矩形范围获取报警信息点的集合
     * */
    public List<WarnRecordEntity>  getWarnRecordByRectangle( String vertexColls ) { return warnRecordEntityDao.getWarnRecordByRectangle(vertexColls); }

    /**
     * 根据指定的四个边界范围获取报警信息点的集合
     * @param north 北界
     * @param east 东界
     * @param south 南界
     * @param west 西界
     * */
    public List<WarnRecordEntity> getWarnRecordByBoundPts(String north,String east, String south,String west) { return warnRecordEntityDao.getWarnRecordByBoundPts(north,east,south,west); }

    /**
     * 根据用户身份证号获取用户详细的报警信息
     * @param idnum
     * @return WarnDetail实例
     */
    public WarnDetail getWarnDetailByIdnum(String idnum) { return warnRecordEntityDao.getWarnDetailByIdnum(idnum);}

    /**
     * 根据详细信息更新报警信息记录
     * @param admin 管理员用户名
     * @param idnum 身份证号码
     * @param warntime 报警时间
     * @param lon 经度
     * @param lat 纬度
     * @return 影响行数
     */
    public int updateWarnRecord(String admin,String idnum,String warntime,String lon,String lat) { return warnRecordEntityDao.updateWarnRecord(admin, idnum, warntime, lon, lat); }
}
